<template>
	<view>
		<view class="lvbox">
			<view class="touxiang">
				<image :src="dataAll.avatar_text" mode=""></image>
			</view>
			<view class="margin_top ershiba xiaobai nofonweight textcenter">{{dataAll.nickname}}</view>
		</view>
		<view class="ffffff mainpadding">
			<view class="flexcenter">
				<u-tabs :list="list2" lineColor="#1BA95B" :scrollable="false" @click="changetab" :activeStyle="{
					    color: '#333333',
					    fontWeight: 'bold',
					    transform: 'scale(1.05)'
					}" :inactiveStyle="{
					            color: '#333333',
								fontWeight: '400',
					            transform: 'scale(1)'
					        }"></u-tabs>
			</view>
			<view class="" v-show="currenttabtow == 0">
				<view class="flexleft margin_top">
					<view class="ershiba xiaohei nofonweight kuandu">姓名：</view>
					<view class="titletext xiaohei nofonweight">{{dataAll.usersmrz.realname}}</view>
				</view>
				<view class="flexleft margin_top">
					<view class="ershiba xiaohei nofonweight kuandu">性别：</view>
					<view class="titletext xiaohei nofonweight">{{dataAll.usersmrz.gender==1?"男":"女"}}</view>
				</view>
				<view class="flexleft margin_top">
					<view class="ershiba xiaohei nofonweight kuandu">邮箱：</view>
					<view class="titletext xiaohei nofonweight">{{dataAll.email}}</view>
				</view>
				<view class="flexleft margin_top">
					<view class="ershiba xiaohei nofonweight kuandu">手机号：</view>
					<view class="titletext xiaohei nofonweight">{{dataAll.mobile}}</view>
				</view>
				<view class="flexleft margin_top">
					<view class="ershiba xiaohei nofonweight kuandu">身份证号：</view>
					<view class="titletext xiaohei nofonweight">{{dataAll.usersmrz.idcard}}</view>
				</view>
				
			</view>
			<view class="" v-show="currenttabtow == 1" activeColor>
				<u-steps dot direction="column" inactiveColor="#1BA95B" activeColor="#1BA95B">
					<u-steps-item :title="item.kcorder.name" :desc="item.kckcb.start_time1+'至'+item.kckcb.end_time1" v-for="item in list.data" :key="item.id">
						<text class="slot-icon" slot="icon" v-if="item.tk_time_text!=''">调</text>
					</u-steps-item>
				</u-steps>
				<!-- <view class="">
					此处参照设计图
					<view class="lvbtn" @click="tztkyy">
						<view class="smalltext xiaolv nofonweight">已调课</view>
						<u-icon name="arrow-right" color="#1BA95B" size="10"></u-icon>
					</view>
				</view> -->
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				currenttabtow: 0,
				list2: [{
						name: '基本信息',
						value: 1,
					},
					{
						name: '课节信息',
						value: 2
					}
				],
				dataAll:{},
				page: 1,
				limit: 20,
				list: {
					data: []
				},
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.getDetail()
			this.init()
		},
		methods: {
			getDetail(){
				httpRequest.request("/api/user/xsUserInfo", 'GET', {
					user_id:this.listid
				}).then(res => {
					this.dataAll = res.data
				})
			},
			init(isPage, page) {
				let _this = this;
				let data = {
					page: page || 1,
					limit: _this.limit,
					ly:1,
					user_id:this.listid
				}
				let url = '/api/user/userKcKcb'
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
						this.$forceUpdate()
					}
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			// 跳转调课原因
			tztkyy(){
				uni.navigateTo({
					url:'/pages/homepagexs/tiaoke'
				})
			},
			changetab(e) {
				this.currenttabtow = e.index;
			},
		}
	}
</script>

<style lang="scss" scoped>
	.slot-icon {
			width: 21px;
			height: 21px;
			background-color: #ffa126;
			border-radius: 100px;
			font-size: 12px;
			color: #fff;
			line-height: 21px;
			text-align: center;
		}
	.lvbtn{
		// width: 100rpx;
		height: 32rpx;
		background: rgba(27,169,91,0.1);
		border-radius: 16rpx 16rpx 16rpx 16rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		border: 2rpx solid #1BA95B;
	}
	.kuandu {
		width: 150rpx;
	}

	page {
		background: #F5F5F5;
	}

	.touxiang {
		margin: auto;
		width: 140rpx;
		height: 140rpx;
		border-radius: 50%;

		image {
			border-radius: 50%;
			width: 100%;
			height: 100%;
		}
	}

	.lvbox {
		background: #1BA95B;
		padding: 50rpx 30rpx 30rpx;
	}
</style>